package com.kefu.core.pub;

import org.tio.core.intf.Packet;

import com.alibaba.fastjson.JSONObject;

public class DefPacket extends Packet{

	/**
	 * 
	 */
	private static final long serialVersionUID = -5157342341481761159L;
	
	public static final int HEADER_LENGHT = 4;//消息头的长度
	public static final String CHARSET = "UTF-8";
	private byte[] body;
	
	private byte type;//消息类型
	
	public String convertBodyToJsonStr(){
		return JSONObject.toJSONString(new String(body));
	}
	
	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public static int getHeaderLenght() {
		return HEADER_LENGHT;
	}

	public static String getCharset() {
		return CHARSET;
	}

	/**
	 * @return the body
	 */
	public byte[] getBody() {
		return body;
	}

	/**
	 * @param body the body to set
	 */
	public void setBody(byte[] body) {
		this.body = body;
	}
}
